package struts2.hanh;

import java.util.ArrayList;

import DAO.Dao_Programme;
import Entity.Programme;

import com.opensymphony.xwork2.ActionSupport;


public class CreatAction extends ActionSupport {
	private String name;
	private String des;
	private String contact;
	private boolean active;
	private ArrayList<Programme> prlist ;

	public ArrayList<Programme> getPrlist() {
		return prlist;
	}


	public void setPrlist(ArrayList<Programme> prlist) {
		this.prlist = prlist;
	}


	@Override
	public String execute() throws Exception {
		if (name.equals("") && des.equals("")) {
			return "error";
		}else{
			Dao_Programme dao =  new Dao_Programme();
			dao.setDs(name, des, contact, true);
			prlist = dao.getProgram();
			return "success";
		}
	}


	public String getName() {
		return name;
	}



	public void setName(String name) {
		this.name = name;
	}



	public String getDes() {
		return des;
	}



	public void setDes(String des) {
		this.des = des;
	}



	public String getContact() {
		return contact;
	}

	public void setContact(String contact) {
		this.contact = contact;
	}

	public boolean isActive() {
		return active;
	}

	public void setActive(boolean active) {
		this.active = active;
	}


}
